<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-18 21:19:33
 * @LastEditTime: 2023-07-08 10:26:42
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: 
 */

namespace App\Http\Controllers\BaseData;

use App\Http\Controllers\Controller;
use App\Http\Services\BaseData\MaterialCategoryService;
use App\Http\Services\BaseData\MaterialService;
use Illuminate\Http\Request;

class MaterialController extends Controller
    {
    //
    public $categoryservice;
    public function __construct(MaterialService $material_service, MaterialCategoryService $categoryservice)
        {
        $this->service         = $material_service;
        $this->categoryservice = $categoryservice;
        }
    /**
     * @OA\Post(
     *   tags={"产品基础资料"},
     *   path="/basedata/material/list",
     *   security={{"bearer_token":{}}},
     *   summary="获取产品列表",
     *   @OA\RequestBody(
     *     required=false,
     *     @OA\MediaType(
     *      mediaType="application/x-www-form-urlencoded",
     *      @OA\Schema(ref="#/components/schemas/MaterialProperties")
     *      )
     *   ),
     *   @OA\Response(
     *         response="200",
     *         description="请求成功",
     *           @OA\JsonContent(
     *             @OA\Property(property="code",title="响应代码",type="integer",example=200),
     *             @OA\Property(property="message",title="错误信息",type="string",example="ok"),
     *             @OA\Property(
     *                      property="data",
     *                      title="响应数据",
     *                      type="array",
     *                      @OA\Items(
     *                          ref="#/components/schemas/MaterialProperties"
     *                      )
     *              )
     *       )
     *     ),
     * )
     */
    public function list()
        {
        return $this->service->list();
        }
    /**
     * @OA\Get(
     *   tags={"产品基础资料"},
     *   path="/basedata/material/categotylist",
     *   security={{"bearer_token":{}}},
     *   summary="产品分组列表",
     *   @OA\Parameter(
     *     name="name",
     *     in="query",
     *     @OA\Schema(type="string")
     *   ),
     *   @OA\Parameter(
     *     name="id",
     *     in="query",
     *     @OA\Schema(type="string")
     *   ),
     *   @OA\Response(
     *         response="200",
     *         description="请求成功",
     *           @OA\JsonContent(
     *             @OA\Property(property="code",title="响应代码",type="integer",example=200),
     *             @OA\Property(property="message",title="错误信息",type="string",example="ok"),
     *             @OA\Property(
     *                      property="data",
     *                      title="响应数据",
     *                      type="array",
     *                      @OA\Items(
     *                          ref="#/components/schemas/MaterialProperties"
     *                      )
     *              )
     *       )
     *     ),
     * )
     */

    public function save(Request $request)
        {
        return $this->service->save($request);
        }
    public function delete(Request $request)
        {
        return $this->service->delete($request);
        }
    public function categorylist()
        {
        return $this->categoryservice->list();
        }
    public function categorydelete(Request $request)
        {
        return $this->categoryservice->delete($request);
        }
    public function categorysave(Request $request)
        {
        return $this->categoryservice->save($request);
        }
    public function lot()
        {
        return $this->service->lot();
        }
    public function listLcategory()
        {
        return $this->service->listLcategory();
        }
    }